package com.guangzhi.weijianzhi.adapter;

import java.util.ArrayList;

import com.guangzhi.weijianzhi.R;
import com.guangzhi.weijianzhi.company.center.CompileCompanyInfoActivity;
import com.guangzhi.weijianzhi.entity.BeansProvince;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAddressadapterOne extends BaseAdapter {
	
private int posi =-1;
	private ArrayList<BeansProvince> privince;
	private Context context;
	public MyAddressadapterOne(ArrayList<BeansProvince> privinces ,Context con){
		this.privince = privinces;
		this.context =con;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
			return privince.size();
		
	}
	public void isSelect(int pos){
		this.posi =pos;
		notifyDataSetChanged();
	}
	
	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		
		
		 TextView tv = new TextView(context);
		 
		  if(posi == arg0){
            	 tv.setTextColor(context.getResources().getColor(R.color.red));
				
			}else{
				tv.setTextColor(context.getResources().getColor(R.color.black));
			}
		 
		 
			tv.setPadding(0, 15, 0, 15);
			tv.setGravity(Gravity.CENTER);
		//	final ArrayList<BeansCity> citys = privinces.get(arg0).getCitys();
			tv.setText(privince.get(arg0).getName());
			
		/*tv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				addreTwo_list.setAdapter(new MyAddressadapterTwo(citys));
				addreThree_list.setVisibility(View.GONE);
			}
		});*/
		return tv;
	}
	
}
